# CMake 最低版本号要求
cmake_minimum_required (VERSION 2.8)

project(Filter)

set (CMAKE_INSTALL_PREFIX /opt/ECG)
INCLUDE_DIRECTORIES( /opt/ECG/include)

if(INSTALL_HEAD_FILE_ONLY)

message(STATUS "just install head files...")

install(FILES inc/filter.h inc/filterFactory.h DESTINATION include/filter)


else(INSTALL_HEAD_FILE_ONLY)
message(STATUS "compile project...")

set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -DBOOST_LOG_DYN_LINK -rdynamic -std=c++11")
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall -DBOOST_LOG_DYN_LINK -rdynamic -std=c++11")

set(BOOST_LIB_DIR /usr/local/lib/boost)

find_library(boost_log libboost_log.so ${BOOST_LIB_DIR})
find_library(boost_filesystem libboost_filesystem.so ${BOOST_LIB_DIR})

set(filter_src src/filterFactory.cpp)

add_library(filterFactory SHARED ${filter_src})
target_link_libraries(filterFactory log ${boost_log} ${boost_system} dl)

install(TARGETS filterFactory DESTINATION  lib)

endif(INSTALL_HEAD_FILE_ONLY)